package cn.bjxy.shishaolong.talk_room.server.entity;

/**
 * 定义一个实体类封装ip和端口
 * @author long
 *
 */
public class IpAndPort {

	private String ip;
	private int port;
	
	public IpAndPort(String ip, int port) {
		super();
		this.ip = ip;
		this.port = port;
	}

	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public int getPort() {
		return port;
	}
	public void setPort(int port) {
		this.port = port;
	}
	
	@Override
	public int hashCode() {

		int result = 17;
		result = 37*result+ip.hashCode();
		result = 37*result+port;
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		return obj instanceof IpAndPort &&
				ip.equals(((IpAndPort)obj).ip) &&
				port == ((IpAndPort)obj).port;
	}

	@Override
	public String toString() {
		return ip + ":" + port;
	}
}
